import request from '@/utils/request';

/**
 * 获取部门列表
 * @returns {Promise<*>}
 */
export async function getDepartmentList(params = null) {
  return request('/admin/sections', { params });
}

/**
 * 添加部门
 * @param params
 * @returns {Promise<*>}
 */
export async function addDepartmemt(params) {
  return request.post('/admin/sections', { params });
}

/**
 * 部门详情
 * @param uid 部门id
 */
export async function showDepartment(uid) {
  return request(`/admin/sections/${uid}`);
}
/**
 * 修改部门
 * @param uid 部门id
 * @param params
 */
export async function editDepartment(uid, params) {
  return request.put(`/admin/sections/${uid}`, { params });
}

/**
 *禁用和启用
 * @param params
 * @param uid 部门id
 * @returns {Promise<RequestResponse<any>>}
 */
export async function lockDepartment(uid) {
  return request.post(`/admin/sections/status/${uid}`);
}

/**
 * 删除部门
 * @param uid 部门id
 */
export async function delDepartment(uid) {
  return request.delete(`/admin/sections/${uid}`);
}
